import { BadRequestException, PipeTransform } from '@nestjs/common'
import { validate } from 'uuid'


export class ParseUUIDPipe implements PipeTransform<string, string> {
  transform(value: string): string{
    // 判断值是不是 uuid
    if (!validate(value)) {
      throw new BadRequestException('Validation failed (uuid is expected)', 'Bad Request')
    }
    return value
  }
}
